import request from "@/utils/request";

// 获取学科列表
export function getSubjectAllNews(params) {
    return request({
        url: "/subject/subject",
        params,
    });
}

// 获取目录列表

export function getDirectoryAllNews(params) {
    return request({
        url: "/subject/directory",
        params,
    });
}
// 获取标签列表
export function getTagAllNews(params) {
    return request({
        url: "/subject/tag",
        params,
    });
}

//增加学科
export function addSubject(data) {
    return request({
        url: "/subject/subject",
        method: "POST",
        data,
    });
}

//删除学科
export function delSubject(id) {
    return request({
        url: "/subject/subject/" + id,
        method: "DELETE",
    });
}

// 单个回显
export const showSubject = (id) => {
    return request({
        url: "/subject/subject/" + id,
    });
};
// 修改数据
export const editSubject = (data) => {
    return request({
        url: "/subject/subject/" + data.id,
        method: "PUT",
        data,
    });
};

// 目录学科显示
export const allDirectory = (_) => {
    return request({
        url: "/subject/tree",
    });
};



// 新增目录
export const adddirectory = (data) => {
    return request({
        url: "/subject/directory",
        method: "POST",
        data,
    });
};
// 删除
export const deldirectory = (id) => {
    return request({
        url: "/subject/directory/" + id,
        method: "DELETE",
    });
};
// 回显
export const showdirectory = (id) => {
    return request({
        url: "/subject/directory/" + id,
    });
};

// 修改
export const editdirectory = (data) => {
    return request({
        url: "/subject/directory/" + data.id,
        method: "PUT",
        data
    });
};
//回显标签
export const showTagdirectory = (id) => {
    return request({
        url: "/subject/tag/" + id,
        method:'get'
    });
};
//编辑标签

export const editTagdirectory = data => {
    return request({
        url: "/subject/tag/" + data.id,
        method: "PUT",
        data
    });
};
//创建标签

export const  newTagdirectory = (data) => {
    return request({
        url: "/subject/tag",
        method: "POST",
        data,
    });
};
//删除标签
export const  delTagdirectory = (id) => {
    return request({
        url: "/subject/tag/"+id,
        method: "DELETE",
        
    });
};
